//
//  TextComposingVC.swift
//  Drop
//
//  Created by zhuxuhong on 2018/3/17.
//  Copyright © 2018年 zhuxuhong. All rights reserved.
//

import UIKit

class TextComposingVC: CommentVC {

    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var authorTF: UITextField!
    @IBOutlet weak var originTF: UITextField!
    
    var drop: Drop!
    
    lazy var image = UIImage.named(self.drop.image)
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        drop = Drop()
        imageView.image = image
    }
    
    override func keyboardAnimation(duration: TimeInterval) {
        UIView.animate(withDuration: duration, delay: 0, options: .curveEaseInOut, animations: {
            self.view.layoutIfNeeded()
        }, completion: nil)
    }

    @IBAction func textFieldEditingChanged(_ sender: UITextField){
        if sender == authorTF {
            drop.content.byAuthor = sender.text ?? ""
        }
        else{
            drop.content.fromBook = sender.text ?? ""
        }
    }
}
